我的 nginx + php 您所在的位置:网站首页 nginx 无权限 我的 nginx + php

我的 nginx + php

2023-03-23 03:43| 来源: 网络整理| 查看: 265

问题:我的 nginx + php-fpm 网络服务器能够提供权限为 000 的网页。为什么?

也许我错过了一些非常基本的东西,但是我的网络服务器如何能够执行和提供来自具有权限 000 的 php 文件的内容?

这是有问题的文件:http://178.62.125.162/test.php

地点是:

/usr/share/nginx/html/wordpress/test.php

这是ls:

---------- 1 deploy deploy 21 May 22 09:40 test.php

nginx.conf 有一行:

user www-data;

所以它不是以 root 或任何方式运行的。

ps aux | grep [n]ginx root 30223 0.0 0.1 85876 1364 ? Ss May21 0:00 nginx: master process /usr/sbin/nginx www-data 30224 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process www-data 30225 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process www-data 30226 0.0 0.2 86516 2732 ? S May21 0:00 nginx: worker process www-data 30227 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process

对我来说看起来很正常,AFAIK 预计以 root 身份运行的主进程。

和 php-fm:

ps aux | grep php root 30311 0.0 1.8 309068 18580 ? Ss May21 0:02 php-fpm: master process (/etc/php5/fpm/php-fpm.conf) www-data 30314 0.0 3.5 393324 36176 ? S May21 0:01 php-fpm: pool www www-data 30315 0.0 3.1 388956 32112 ? S May21 0:01 php-fpm: pool www www-data 30391 0.0 2.9 389828 29528 ? S May21 0:00 php-fpm: pool www

我什至无法自己打开文件,以部署身份登录:

cat test.php cat: test.php: Permission denied php test.php Could not open input file: test.php

到处都在谷歌上搜索,但我发现的大多数事情都与相反的人有关——人们得到了禁止的错误。

也许是因为它在 /usr/share 中?谢谢!

额外信息:

Ubuntu x64 LTS

PHP-FM

更新:

更改权限后重新启动 php-fm 服务可以修复它。但这对我来说毫无意义:

chmod 000 test.php - web echos "test" service php5-fm restart - Access Denied chmod 644 test.php - web echos "test". No need for a restart this time? chmod 000 test.php - web echos "test". 解答

感谢 Alexander Ushakov 提供答案。

具有可读权限的文件已被 php-fm 缓存。重新启动 php-fm 意味着缓存被清除,然后 Web 服务器以受限访问为新文件提供服务。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有